var pEditor = document.getElementById('editorContainer')
var pList = document.getElementById('listContainer')

var txtPName = document.getElementById('pName')
var txtPType = document.getElementById('pType')
var txtPImg = document.getElementById('pImg')
var txtPLink = document.getElementById('pLink')
var txtPPrice = document.getElementById('pPrice')

//通过 element.classList.add('样式名') //新增一个class样式
//.......................remove('样式名') //删除一个样式
function addHandle(e) {
    pEditor.style.display = 'block'
    pList.style.display = 'none'
    pEditor.classList.add('zoomIn')
}

function subHandle(e) {
    // pList.classList.remove('rollOut')
    pEditor.style.display = 'none'
    pList.style.display = 'block'
    pList.classList.add('zoomIn')
    var strData = `pName=${txtPName.value}&pType=${txtPType.value}&pImg=${txtPImg.value}&pLink=${txtPLink.value}&pPrice=${txtPPrice.value}` 
    Api.saveData(strData,function(res){
        console.log(res)
        getData()
    })
}
function getData(){
    Api.getData(function(res){
        //拼字符串///////
        var goods = res.data//所有的商品信息
        console.log(goods)
        // goods.forEach。。。。
    })
}
getData()